// 路由守卫
export const routerGuard = {
  // 页面跳转前检查登录状态
  beforeEach(to) {
    const token = uni.getStorageSync('token');
    const whiteList = ['/pages/auth/login', '/pages/auth/register']; // 白名单
    
    if (!token && !whiteList.includes(to)) {
      uni.redirectTo({
        url: '/pages/auth/login'
      });
      return false;
    }
    return true;
  }
}; 